package com.huatai.bi.websocket;

import com.alibaba.fastjson.JSONObject;
import com.huatai.bi.constant.RabbitmqConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @program: ganghua
 * @description: mqtt通知
 * @author: songxiude
 * @create: 2024-09-19 09:53
 **/
@Component
public class FanoutSender {
	@Autowired
	private RabbitTemplate rabbitTemplate;

	public void sendMessage(Map<String, MessageResult> rabbitMessageList) {
		rabbitTemplate.convertAndSend(RabbitmqConstant.FANOUT_EXCHANGE_NAME, "", JSONObject.toJSONString(rabbitMessageList));
	}

	public void sendMessages(MessageResult messageResult) {
		rabbitTemplate.convertAndSend(RabbitmqConstant.FANOUT_EXCHANGE_NAME, "", JSONObject.toJSONString(messageResult));
	}

}
